-- money_drop
-- created by xinj
-- 掉落金币(基准值 + 浮动值)

return {
    apply = function(prop, baseValue)
        return baseValue + prop[3];
    end,

    -- 死亡触发
    trigger = function(who, prop, arg)
        if who.type ~= OBJECT_TYPE_MONSTER then
            return;
        end

        local amount = prop[3];
        local fluti  = tonumber(prop[2]);

        local seed = DungeonM.getRandSeed("money_drop");

        amount = amount + fluti * (seed % 3 - 1);

        local bonus = {2, "money", amount,};

        -- 设置属性奖励，金币加个闪光
        local class = DungeonM.getClassByType(GRID_TYPE_ITEM);
        local pos = who:getPos();
        DungeonM.transformGrid(class, pos, GRID_STATE_OPEN, {["bonus"] = bonus, ["need_shining"] = 1, });

        return true;
    end,

    record = function(target, prop, path)
        return false;
    end
};
